package monitor.config;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;

public class Configuration {

	private static Properties properties;

	static {
		init();
	}

	private static void init() {
		InputStream in = Configuration.class
				.getResourceAsStream("./cfg.properties");
		properties = new Properties();
		try {
			properties.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static Object getProperty(Object key) {
		return properties.get(key);
	}

	public static Properties getProperties() {
		return properties;
	}

	public static void main(String[] args) throws UnknownHostException {
		String ip = (String) Configuration.getProperty("inetAddress");
		InetAddress addr = InetAddress.getByName(ip);
		System.out.println(addr);
	}
}
